<template>
  <div>
    <el-form :inline="true" :model="searchData" class="demo-form-inline">
      <el-form-item label="AO编码">
        <el-input size="mini" v-model="searchData.aoCode" placeholder="AO编码"></el-input>
      </el-form-item>
      <el-form-item label="起始架次">
        <el-input size="mini" v-model="searchData.startPlaneNo" placeholder="起始架次"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button size="mini" type="primary" @click="smstSearch">查询</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
import request from "@/utils/request.js"
export default {
  name: "topSearch",
  data() {
    return {
      searchData:{
        aoCode:'',
        startPlaneNo:'',
      },
      pageSize:20,
      pageNumber:1
    };
  },
  methods:{
    // 查询
    smstSearch(){
      request.post("/replacementAoSortiesRest/searchMatching",{
        searchParams:{
          aoCode:this.searchData.aoCode,
          startPlaneNo:this.searchData.startPlaneNo,
        },
        pageParameter:{
          rows:this.pageSize,
          page:this.pageNumber
        }
      }).then((res)=>{
        console.log("返回数据",res.data)
        if(res.data.retCode == 200){
          this.$bus.$emit('smStTopSearch',res)
        }
      })
    }
  },
  mounted(){
    // 接收Top表的分页--每页条数--进行查询
    this.$bus.$on('smStToptablePageSize',(e)=>{
      this.pageSize = e
      request.post("/replacementAoSortiesRest/searchMatching",{
        searchParams:{
           aoCode:this.searchData.aoCode,
          startPlaneNo:this.searchData.startPlaneNo,
        },
        pageParameter:{
          rows:this.pageSize,
          page:this.pageNumber
        }
      }).then((res)=>{
        if(res.data.retCode == 200){
          this.$bus.$emit('smStTopSearch',res)
        }
      })
    })
    // 接收Top表的分页--页数--进行查询
    this.$bus.$on('smStToptablePageNumber',(e)=>{
      this.pageNumber = e
      request.post("/replacementAoSortiesRest/searchMatching",{
        searchParams:{
          aoCode:this.searchData.aoCode,
          startPlaneNo:this.searchData.startPlaneNo,
        },
        pageParameter:{
          rows:this.pageSize,
          page:this.pageNumber
        }
      }).then((res)=>{
        if(res.data.retCode == 200){
          this.$bus.$emit('smStTopSearch',res)
        }
      })
    })
  }
};
</script>
